//
//  ViewController.m
//  Model
//
//  Created by YDJH on 2017/5/19.
//  Copyright © 2017年 YDJH. All rights reserved.
//

#import "ViewController.h"
#import "BuildingConstructionLogicSystem.h"
#import "RoomViewController.h"
#import "HZOutsideRoomViewController.h"
#import "HZConstruction.h"
#import "HZSandTable.h"
#import "SandTableViewController.h"
#import "ModelToJson.h"

@interface ViewController () {

    HZConstruction *_construction;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    BuildingConstructionLogicSystem *logic = [BuildingConstructionLogicSystem standardBuildingConstructionLogicSystem];
    
   _construction = [logic configureHZConstructionWith:@"school"];
    
    // Do any additional setup after loading the view, typically from a nib.
    
  //  NSDictionary *dict = [ModelToJson getObjectData:_construction];
    
    [ModelToJson print:_construction];
}
- (IBAction)enter:(id)sender {
    
    RoomViewController *room = [[RoomViewController alloc] init];
    room.buildingStructure = (NSMutableArray *)[[_construction.sandTable.outsideBuilding firstObject] buildingStructure];
    [self presentViewController:room animated:YES completion:nil];
    
}
- (IBAction)firist:(id)sender {
    
    
}

- (IBAction)sandTable:(id)sender {
    if (_construction.sandTable) {
        SandTableViewController *sandtableVC = [[SandTableViewController alloc] init];
        sandtableVC.construction = _construction;
        [self presentViewController:sandtableVC animated:YES completion:nil];
   
    }else {
        HZOutsideRoomViewController *firist = [[HZOutsideRoomViewController alloc] init];
        firist.building = _construction.building;
        
        [self presentViewController:firist animated:YES completion:nil];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
